<?php
/**
 * IMMOPHP
 * @desc permet d ajouter un bloc depuis les blocs disponible
 * @autor Drouche Romain
 * */
require 'kernel/common.php';

if(!$Session->check_admin()) redirect('index.php');

if(!$id = retrieve('GET','bloc',true)) 
    redirect('bloc.php?error=no_bloc_select');
    
require_once IMMOPHP_ADMIN_ROOT_PATH.'kernel/Bloc.class.php';

$Bloc = new Bloc($paramClass);

$Bloc->getBlocDisponible($id);

$smarty->assign('bloc', $Bloc->bloc);
$smarty->assign('emplacement_array', $Bloc->getEmplacementArray() );
$smarty->assign('lang', $lang);
$smarty->assign('token', $Session->_session['token']);

$smarty->display('bloc_active_disponible.tpl');

# recuperation du bloc dans la base
//$Bloc = $db->sql_query("SELECT * FROM immo_bloc_disponible WHERE id ='". $id ."'",'OBJECT');
//if($db->nb_resultat != '1') redirect('bloc.php?error=bloc_existe_pas');
/*
$template->set_filenames(array('bloc_active' => 'template/bloc_active_disponible.tpl'));
$template->assign_vars(array(
'V_NOM_BLOC'    =>  $Bloc->nom,
'V_DESCRIPTION_BLOC'    =>  $Bloc->description,
'V_PLUGINS_BLOC'    =>  $Bloc->plugins,
'V_ID'  =>  $id,
'L_BLOC'    =>  $lang['Bloc'],
'L_ENREGISTRER' =>  $lang['Enregistrer'],
'L_GESTION_DES_BLOCS'    =>  $lang['Gestion_des_blocs'],
'L_PLUGINS' =>  $lang['Plugins'],
'L_TITRE'   =>  $lang['Titre'],
'L_EMPLACEMENT' =>  $lang['Emplacement'],
'L_ORDRE'   =>  $lang['Ordre'],
'L_NOM' =>  $lang['Nom'],
'L_INFORMATION_BLOC'    =>  $lang['Information_bloc'],
'L_DESCRIPTION' =>  $lang['Description'],
'L_HAUT_GAUCHE' =>  $lang['Haut_gauche'],
'L_HAUT_DROITE' =>  $lang['Haut_droite'],
'L_HAUT_CENTRE' =>  $lang['Haut_centre'],
'L_GAUCHE'  =>  $lang['Gauche'],
'L_DROITE'  =>  $lang['Droite'],
'L_BAS_GAUCHE'  =>  $lang['Bas_gauche'],
'L_BAS_DROITE'  =>  $lang['Bas_droite'],
'L_BAS_CENTRE'  =>  $lang['Bas_centre'],
));
*/
//$template->display('bloc_active');
require 'footer.php';
?>